//Day 04-2

#define _CRT_SECURE_NO_WARNINGS 1

#include <stdio.h>
#include <string.h>
#include <assert.h>

int main()
{
	
	int n = 0;
	scanf("%d", &n);
	while (n)
	{
	again:

		int flagchA = 0;
		int flagnum = 0;
		int flagcha = 0;
		int other = 0;

		char ch[100] = "0";
		scanf("%s", ch);
		if ((strlen(ch) < 8) && (ch[0] >= '0' && ch[0] <= '9'))
		{
			printf("NO\n");
			continue;
		}
		char* p = ch;
		for (; *p != '\0'; p++)
		{
			if (*p >= 65 && *p <= 86) flagchA++;
			else if (*p >= 97 && *p <= 118) flagcha++;
			else if (*p >= '0' && *p <= '9') flagnum++;
			else
			{
				printf("NO\n");
				goto again;
			}
		}
		if ((flagchA > 0) + (flagcha > 0) + (flagnum > 0) < 2)
		{
			printf("NO\n");
			continue;
		}
		printf("YES\n");
		n--;
	}
	return 0;
}